Repository navigation
Fix the timeline trace lock so a window behind another writer persists - #2709
Merged
Merged
Conversation
A trace opened while another process held writer.lock stayed memory-only for the rest of its life: the lock was taken once at open, and flush() answered true although the appended spans never reached the disk. The store can now ask for the lock again when it has something to write, adopts the segments already on disk when it gets it, and answers false (naming the reason once) while it still cannot write. Tested with two real child processes on one trace directory: the window behind the writer takes the lock after the writer exits and its span lands on disk, while a blocked flush returns false and warns once. Fixes #2706 Docs-not-needed: the change stays inside the timeline store's existing single-writer design; no subsystem contract, owned path or public architecture changed.
Collaborator
Author
|
Verdict: PASS at ddba790 Ran at this tip: Red first: with Review points:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Written-by: Dev
Fixes #2706
Owner: Dev
Reviewer: Reviewer
What changed
A timeline window that opened while another window was writing the trace stayed memory-only for the rest of its life: the writer lock was taken once at open, and
flush()answeredtruewhile the appended spans never reached the disk. The trace store now asks for the lock again when it has something to write, adopts the segments already on disk when it gets it (so the first writer's history is kept, not overwritten), and a flush that still cannot write answersfalseand names the reason once. The writer-lock refusal is unchanged for callers that do not opt into the retry,stats().persiststays a boolean and flips totruewhen the window starts persisting, and the window'spersistingflag follows it.Verification at the tip
Tip SHA: ddba790
Ran:
cd plugins/timeline && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/d2607/repo/core/dev/harness node --import ./test/resolve.mjs --test "test/*.test.js"— 161/161 pass, including the newtrace-lock-retry.test.js(two real child processes on one real trace lock)TZ=UTC node .github/scripts/changelog.mjs check— fragments well formedDSH_HARNESS=... TZ=UTC node scripts/lint-plugins.mjs— 0 errorsNot run (and why):
npm run verifyat the repo root — the change lives only inplugins/timeline/; its suite, the plugin lint and the changelog check are the affected checks, and the core is untouched (no client build ords-bot-patchesrun needed).node .github/scripts/check-arch-docs.mjs— this checkout has no git history, so that check cannot run here;Docs-not-needed:covers it instead (see below).Docs-not-needed: the change keeps the timeline store's existing single-writer design (one writer, write-tmp + fsync + rename, capped segments); the lock is now retried by the timeline itself, and no subsystem contract, owned path or public architecture changed.
Checkpoint
{ "pr": 2709, "claim": "Dev", "issue": 2706, "summary": "A timeline window that opened behind another trace writer no longer stays memory-only forever. It asks for the writer lock again when it has something to write, adopts the segments already on disk when it gets it, and keeps them instead of overwriting. While the lock is still held, flush() answers false and names the reason once rather than reporting success for a span it dropped. stats().persist stays a boolean and flips to true once the window starts persisting.", "files": ["plugins/timeline/src/store.js", "plugins/timeline/src/timeline.js", "plugins/timeline/test/trace-lock-retry.test.js", "changelog.d/2706-trace-lock.fixed.md"], "checks": { "ran": "cd plugins/timeline && TZ=UTC DSH_HARNESS=... node --import ./test/resolve.mjs --test \"test/*.test.js\"; node .github/scripts/changelog.mjs check; node scripts/lint-plugins.mjs", "result": "green", "at": "ddba790de13a1ee10a9456236b5413dd457cc717" }, "next": "none — ready for review" }